import { defineStore } from 'pinia'
 

export const userStore = defineStore('demo', {
	// 创建状态
	state: () => {
		return {
			userName: '小明',
			userScore: 0,
		}
	},
	// 创建getter方法
	getters: {
		userInfo: (state) => {
			return `user:${state.userName},score:${state.userScore}`
		}
	},
	// 创建action方法
	actions: {
		add() {
			this.userScore++;
		}
	}

})